#include<iostream>
#include<string>
#include<unordered_map>

using namespace std;
string s, str;
unordered_map<int, int> mp;
string cvt(string& tmp)
{
    for (int i = 0; i < tmp.size(); i++) tmp[i] = tolower(tmp[i]);
    return tmp;
}
int main()
{
    cin >> s;
    cin.ignore();
    getline(cin, str);
    for (int i = 0; i < s.size(); i++) s[i] = tolower(s[i]);
    int pos = 0, len = 0;
    int rpos = -1, rcount = 0;
    while (len != -1)
    {
        len = str.find(' ', pos);
        string tmp = str.substr(pos, len - pos);
        pos = len + 1;
        // zdl:: 这样的方法就可以直接将整个字符串都遍历
        if (cvt(tmp) == s) 
        {
            // cout << tmp << endl;
            if (rpos == -1) rpos = pos - tmp.size() - 1;
            rcount++;
        }
    }

    if (rpos == -1) cout << -1 << endl;
    else cout << rcount << " "  << rpos << endl;
    return 0;
}